﻿Imports System.Data
Imports System.Data.OleDb

Public Class Form1

    Private Sub NuevoUsuarioToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles NuevoUsuarioToolStripMenuItem.Click
        Dim form As New frmRegUsuario
        form.ShowDialog()

    End Sub

    Private Sub Form1_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
        Conexion.Close()
    End Sub

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        
        Conectar()

    End Sub

    Private Sub RegistroDeMedidasToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RegistroDeMedidasToolStripMenuItem.Click
        Dim form1 As New frmRegMedidas
        form1.ShowDialog()
        'RegistroDeMedidasToolStripMenuItem.Enabled = False

    End Sub

    Private Sub ConectarToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ConectarToolStripMenuItem.Click
        Conectar()
    End Sub
    Sub Conectar()
        OpenFileDialog1.ShowDialog()
        RutaBD = OpenFileDialog1.FileName

        'Conexion.ConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Users\Sergio\Desktop\Recorfit\Recorfit\DBRecorfit.accdb"
        Try
            Conexion.ConnectionString = Cadena_Conexion & RutaBD
            Conexion.Open()
            'MsgBox("Bienvenido", MsgBoxStyle.Information)
        Catch ex As Exception
            MsgBox("Error de conexion de Base de Datos", MsgBoxStyle.Critical)

        End Try

        Usuario = "PRUEBA"

    End Sub

    Private Sub MaquinasToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MaquinasToolStripMenuItem.Click
        Dim form As New frmMaquina
        form.ShowDialog()

    End Sub

    Private Sub RegistrosDeCardioToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RegistrosDeCardioToolStripMenuItem.Click
        Dim form As New frmRegCardio
        form.ShowDialog()
    End Sub

    Private Sub SalirToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SalirToolStripMenuItem.Click
        End

    End Sub

    Private Sub RegistrosDeControlDePesoToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RegistrosDeControlDePesoToolStripMenuItem.Click
        Dim form As New frmControlPeso
        form.ShowDialog()
    End Sub

    Private Sub AcercaDeRecorfitToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AcercaDeRecorfitToolStripMenuItem.Click
        AboutBox1.ShowDialog()
    End Sub
End Class
